import os;
import subprocess;


def call_os():
    print("start! good luck")
    pwd = os.system("pwd")
    # cd 命令没有返回值，且对下一条语句没有作用，不能用
    fish = os.system("cd ~/project/front/NiceFish")
    pwd = os.system("pwd")


def call_os_read():
    # 也是一次性，但是可以读到返回值
    pwd = os.popen("pwd")
    cd = os.popen("cd ~/project/front/NiceFish")
    pwd2 = os.popen("pwd")
    print(pwd.read())
    print(cd.read())
    print(pwd2.read())


nowtime = subprocess.Popen('cd ~/project/front/NiceFish', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
pwd = subprocess.Popen('pwd', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(nowtime.stdout.read())
print(pwd.stdout.read())
